<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//首页控制器
class OrderlistController extends Controller{

//  显示主页
    public function index(){
    	$orderdity= new \Common\Model\Order;
		$hid=$_SESSION['hid'];
		$orderdata=$orderdity->join('orderlist','orderdity_oid','=','oid')->join('commodity','commodity_cmid','=','cmid')->where("homeuser_hid=$hid")->get();
		$arr=array();
		foreach ($orderdata as $v) {
			$arr[$v['oid']][]=$v;
		}
//		分配数据
		View::with('arr',$arr);

       View::make();
    }
	
	public function del(){
//		获得订单id
		$oid=Q('get.oid',0,'intval');
//		实例化订单表
		$order= new \Common\Model\Order;
//		实例化订单列表
		$orderdity= new \Common\Model\Orderls;
		$order->where("oid=$oid")->delete();
		$orderdity->where("orderdity_oid=$oid")->delete();
	    View::success('取消成功');
	}
}
